lcDrwInsertSHP | Home |
BOOL lcDrwInsertSHP ( HANDLE hDrw, HANDLE hLayer, LPCWSTR szFileName, HANDLE hLcWnd ); |
hDrw | |
Handle to a drawing object. | |
hLayer | |
Handle to a layer for added entities. | |
szFileName | |
The filename of the shapefile. If empty name or NULL is specified, then "Open File" dialog will be displayed to let user select a file. | |
hLcWnd | |
Handle to LiteCAD graphics window. May be ignored (specify NULL) if the "Open File" dialog is not used. |
If the function succeeds, the return value is nonzero (TRUE). |
You can load ESRI Shapefile from "Layers" dialog. Click with right button
on the layer record - the popup menu will appear with the proper item. |
BOOL bOK; int nEnts; HANDLE hEnt, hBlock; bOK = lcDrwInsertSHP( hLcDrw, hLayer, L"", hLcWnd ); if (bOK){ // get number of added entities nEnts = lcPropGetInt( 0, LC_PROP_G_INT ); // get handle of first added entity hEnt = lcPropGetHandle( 0, LC_PROP_G_HANDLE ); if (hEnt){ // get handle of the block which contains added entities hBlock = lcPropGetHandle( hEnt, LC_PROP_ENT_BLOCK ); while( hEnt ){ // set color of the entity lcPropPutInt( hEnt, LC_PROP_ENT_COLOR, RGB(255,0,0) ); // get next added entity hEnt = lcBlockGetNextEnt( hBlock, hEnt ); } } }